<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type">
    <title>Scroll</title>
    <script type="text/javascript" src="../jquery-1.6.2.js"></script>
    <style type="text/css">
        html,body{ padding: 0;margin: 0; }
    </style>
</head>
<body>
<div id="div" style="width:2250px; height: 1224px; border:1px solid #ccc; padding: 10px; ">
    <div style="width:220em; height: 300px;">asdf</div>
    <div id='t' style="width:50%;"></div>
    <a href="#" id="abc" style="position: absolute;left: 500px; top:400px;">abc</a>
</div>
<script type="text/javascript">
    alert($('#t').width());
  

   
    var abc=document.getElementById('abc');
    var div=document.getElementById('t');
  var currentStyles=null;
    try {
//获取不到综合属性的值，如border,想获取要拆分
    currentStyles = document.defaultView.getComputedStyle(div, null);
    } catch (e) {
        currentStyles = div.currentStyle; //兼容IE
    }
    var rect =  div.getBoundingClientRect();
    alert( rect.right - rect.left)

    alert(currentStyles.width); //100px
    abc.onclick=function(){
        //console.dir(document.body );
        alert(document.documentElement.scrollLeft||document.body.scrollLeft);
        alert(document.documentElement.scrollTop||document.body.scrollTop);
        alert($(document).scrollLeft());
    }

    var Position={
        iScrollLeft:document.documentElement.scrollLeft||document.body.scrollLeft,
        iScrollTop:document.documentElement.scrollTop||document.body.scrollTop,
        iViewWidth:document.documentElement.clientWidth||document.body.clientWidth,
        iViewHeight:document.documentElement.clientHeight||document.body.clientWidth,
        iDocWidth:Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),
        iDocHeight:Math.max(document.documentElement.scrollHeight,document.body.scrollHeight)
    }
    var oDiv=document.createElement('div');
    oDiv.style.width=Position.iDocWidth+'px';
    oDiv.style.height=Position.iDocHeight+'px';
    oDiv.style.position='absolute';
    oDiv.style.left=0;
    oDiv.style.top=0;
    oDiv.style.zIndex=124;
    oDiv.style.background='#ccc';
    document.body.appendChild(oDiv);
</script>
</body>
</html>